/**
 * 权限管理
 */
module.exports = {
    /**
     * 从session中读取用户，登陆后才可读取
     */
    getUser:(req,res,next)=>{
        req.user = req.session.user;
        next()
    },
    /**
     * 限制未登录无法进入后台
     */
    allowToAdmin:(req,res,next)=>{
        let {user} = req.session
        console.log(user,123);
        if(user){
            console.log(user);
            req.user = user;
            next()
        }else{
            res.send('未登录无法进入后台')
        }
    }
}